/**
  ******************************************************************************
  * @file           : syscfg.h
  * @brief          : This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __SYSCFG_H
#define __SYSCFG_H

#include <stdint.h>
#include "route.h"

#define SYSCFG_STORAGE_KEY    "SYSCFG"
#define SYSRIL_STORAGE_KEY    "SYSRIL"

typedef struct
{
	uint8_t lora_num;
	uint8_t rs485_num;
}SysCfg_ParameterType;

typedef struct
{
	uint8_t  year;
	uint8_t  month;
  uint8_t  day;
  
  uint16_t clnum;
  int      ril;
}SysRil_ParameterType;

typedef struct
{
	char key[8];
	SysCfg_ParameterType para;
}SysCfg_StorageType;

typedef struct
{
	char key[8];
	SysRil_ParameterType para;
}SysRil_StorageType;

extern SysCfg_ParameterType SysCfg_RunPara;
extern SysRil_ParameterType SysRil_RunPara;


extern void SysCfg_SavePara(void);
extern uint8_t SysCfg_LoadPara(void);

extern int SysRil_Day_diff(int year_start, int month_start, int day_start, int year_end, int month_end, int day_end);
extern void SysRil_SavePara(void);
extern uint8_t SysRil_LoadPara(void);

extern uint8_t SysCfg_CheckPara(SysCfg_ParameterType *para);

#endif /* __SYSCFG_H */
